<?php 
$attribute = array('class'=>'form_input');
$hidden = array('percent'=>$model['percent'],'title'=>$model['title']);
echo form_open('',$attribute,$hidden);?>
<div class="con">
<h3>{{ helper:lang line = 'project:percent' }}: 
	<?php echo $model['percent'] ?> %
</h3>
</div>
<div class="con">
<div class="slider" per="<?php echo $model['percent'] ?>"></div>
<div class="time" style="clear:both;height:30px;">

<input type="text" name="date_start" class="fl date_start from" value="{{helper:date format = 'd-m-Y' timestamp = model:date_start}}" />
<div class="fl">
<input id="timepicker_start" value="{{helper:date format = 'H:i' timestamp = model:date_start}}" class="timepicker timepicker_start" name="timepicker_start" />
</div>

<div class="fr">
<input id="timepicker_end" value="{{helper:date format = 'H:i' timestamp = model:date_end}}" class="timepicker timepicker_end" name="timepicker_end" />
</div>
<input  type="text" name="date_end" class="fr date_end to" value="{{helper:date format = 'd-m-Y' timestamp = model:date_end}}" />

<!--<label class="fl">{{helper:date format = 'd-m-Y' timestamp = model:date_start}}</label>
<label class="fr">{{helper:date format = 'd-m-Y' timestamp = model:date_end}}</label>
-->
</div>
<div class="input">
	{{helper:lang line = 'project:priority' }} : <span class="text_priority"></span>
		<input type="hidden" name="priority_id" id="priority_id" value="<?php echo $model['priority_id']?>" />
	</div>
	<div class="input">
		<div class="priority_slider" style="width:40%"></div>
	</div>
</div>
<div class="fl" style="width:40%;">
<div class="con">
<h3>{{ helper:lang line = 'project:user_receive' }}</h3>
<ul class="style1">
<li>
	<input type="checkbox" value="" class="checkAll" />
	<a class="del" pid="<?php echo $model['id'] ?>">{{helper:lang line="global:delete_selected"}}</a>
</li>
<?php foreach($project_users as $item ){ 
	$checked = NULL;
	$checked = ($user_receive == $item->user_id ) ? TRUE : NULL;
	if(isset($model['important'])){
		//echo $model['important'];
		$checked = ($item->user_id == $model['important'])  ? TRUE : NULL;
	}
?>
	<li class="im-<?php echo $item->important?>">
		<?php if($user_receive != $item->user_id ) { ?>
		<input type="checkbox" name="cbx-item[]" class="cbx-item" value="<?php echo $item->user_id ?>" />
		<?php } else { ?>
		<span style="display:block;width:25px;height:1px;float:left"></span>
		<?php } ?>
		{{text:toupper value = '<?php echo $item->display_name?>'}}
		<?php echo form_radio('important',$item->user_id,$checked);?>
		<!--<input type="radio" {{checked}} name="important" value="1" />-->
	</li>
<?php } ?>
</ul>
</div>

<?php 
	echo form_dropdown('user_receive[]',$employees_select,'','multiple class="chosen inHoa large" style="width:90%" data-placeholder = "'.lang('project:add_user_receive').'" ')
?>					
</div>
<div class="fr" style="width:55%;border-left:1px solid #ccc;padding-left:10px">
<div class="con">
<h3>{{ helper:lang line = 'project:description' }}</h3>
<?php 
	$data = array('name'=>'description','id'=>'description','value'=> $model['description'],'class'=>'editor large', 'rows'=>10,'cols'=>80);
	echo form_textarea($data) ?>
</div>
</div>
<button name="btnAction" value="save">Save</button>
<?php echo form_close();?>

<script type="text/javascript">
$('.timepicker_start').timepicker();
$('.timepicker_end').timepicker();

CKEDITOR.config.toolbar = [
   ['Styles','Format','Font','FontSize'],
   //'/',
   ['Bold','Italic','Underline','StrikeThrough','-','Undo','Redo','-','Cut','Copy','Paste','Find','Replace','-','Outdent','Indent','-','Print'],
   ['NumberedList','BulletedList','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock']
   //['Image','Table','-','Link','Flash','Smiley','TextColor','BGColor','Source']
] ;
CKEDITOR.replaceClass = 'editor';

for_slider();

$(".chosen").chosen({
	//display_selected_options:true,
	no_results_text: "Oops, nothing found!",
	disable_search_threshold: 10
}); 



<?php if(isset($model['user_receive'])){?>
var json = <?php echo json_encode($model['user_receive']);?>;
$('select.chosen').val(json);
$('select.chosen').trigger('liszt:updated');
<?php } ?>

$('.checkAll').on('click', function () {
	$(this).closest('ul').find('.cbx-item').prop('checked', this.checked);
});
$('.del').click(function(){
	$mes = confirm(kunkun.lang.dialog_message);
	kunkun.delete = $mes ? true :false;
	if(kunkun.delete){
		$data = [];
		$id = $(this).attr('pid');
		$list_del = $('.cbx-item:checked');
		for($i = 0;$i<$list_del.length;$i++){
			$data.push($list_del.eq($i).val());
		}
		
		$.ajax({
			url:'{{url:site uri="business/delete_users"}}',
			data:{id:$id,data: $data},
			type:'post',
			success:function(){
				location.reload();
			}
		});
	}
});

$(function() {
    $( "input.from" ).datepicker({
	dateFormat:"dd-mm-yy",
    defaultDate: "+1w",
    changeMonth: true,
    numberOfMonths: 3,
    onClose: function( selectedDate ) {
      $( "input.to" ).datepicker( "option", "minDate", selectedDate );
    }
    });
	
    $( "input.to" ).datepicker({
	dateFormat:"dd-mm-yy",
      defaultDate: "+1w",
      changeMonth: true,
      numberOfMonths: 3,
      onClose: function( selectedDate ) {
        $( "input.from" ).datepicker( "option", "maxDate", selectedDate );
      }
    });
  });

//muc do uu tien

$pr_id = $('input#priority_id').val();
//background_slider( $( ".priority_slider" ),$pr_id);
$(function() {

    $( ".priority_slider" ).slider({
      range: "min",
      min: 0,
      max: 2,
      value: parseInt($pr_id),
      slide: function( event, ui ) {
        $( "#priority_id" ).val( ui.value );
		background_slider( $( ".priority_slider" ),ui.value);
      }
    });
    $( "#priority_id" ).val( $( ".priority_slider" ).slider( "value" ) );
	background_slider( $( ".priority_slider" ),$pr_id);
  });
function background_slider($slider,$value){
	$color = "";
	if($value == 0){
		$color = '#82BA00';
		$(".text_priority").text("<?php echo $list_priority[0];?>");
		$(".text_priority").css('color','#82BA00');
	}
	if($value == 1){
		$color = '#2bc252';
		$(".text_priority").text("<?php echo $list_priority[1];?>");
		$(".text_priority").css('color','#2bc252');	
	}
	if($value == 2){
		$color = '#db3e3e';
		$(".text_priority").text("<?php echo $list_priority[2];?>");
		$(".text_priority").css('color','#db3e3e');
	}
	$slider.find('.ui-slider-range').css('background',$color);
	$slider.find('.ui-widget-header').css('background',$color);
	$slider.find('.ui-slider-handle').css('border-color',$color);
}  
  </script>
  
</script>